UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Sc4MpLGLBjX8YTCvtwC8xvke3ApPwj13GM4rqnVAyNM=' 
WHERE 
  key_id = 'e85e354c67882a1ca84889235132309cd1df136b20ae1214db78d21790dd919b' 
  AND (
    token = 'Sc4MpLGLBjX8YTCvtwC8xvke3ApPwj13GM4rqnVAyNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032