UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qXCIpd+ewlEGiVfr0mHkmgUvJWqtTwO0ZyhnJQNLwek=' 
WHERE 
  key_id = '74e952e9c595734bd836e7f04937242a54f8ce34af028a118f45375cd1373db4' 
  AND (
    token = 'qXCIpd+ewlEGiVfr0mHkmgUvJWqtTwO0ZyhnJQNLwek=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038