UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ohpUNVm54THeUfydlVkjlsIEa7jaEjoiyoART1RiwM=' 
WHERE 
  key_id = 'd89d08b610e1dd111f0e3fc5a085eb989360e7b2efc2ffc35ec8d04e109319bf' 
  AND (
    token = '5ohpUNVm54THeUfydlVkjlsIEa7jaEjoiyoART1RiwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024