UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qHVihktNfNja5+mn045Xox4pwIC8PpEuKF+bdpvAvfs=' 
WHERE 
  key_id = 'ad55f4c30c6392930bf4681019380f22980b6b6ad82163dc22729f116412d58d' 
  AND (
    token = 'qHVihktNfNja5+mn045Xox4pwIC8PpEuKF+bdpvAvfs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027