UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'n985Thu0jR84DTRy3X2S3SHfM2DJHmCziqV6k+46fbo=' 
WHERE 
  key_id = '20ddddc33d63b2a8359b3c34f7fe744a7b1614eeb6b026d388ae25fa14e837e9' 
  AND (
    token = 'n985Thu0jR84DTRy3X2S3SHfM2DJHmCziqV6k+46fbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034