UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qi+3Ixf4QYvvuOMF0ArknfGIdrS1XKDxYLk0vSXpqic=' 
WHERE 
  key_id = 'eba47d1a1217f582aef28961d8912f485a6d175385a44c2944a226edb413260c' 
  AND (
    token = 'Qi+3Ixf4QYvvuOMF0ArknfGIdrS1XKDxYLk0vSXpqic=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043