UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gMvejrCk/bNBR2lU3thDfFrwnQuh44BxFg4G2xkErwQ=' 
WHERE 
  key_id = 'b334e3fff58b9db089919216b1e1a94a5de03afce7584f11bc8a92ee600f7659' 
  AND (
    token = 'gMvejrCk/bNBR2lU3thDfFrwnQuh44BxFg4G2xkErwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00074