UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ojzZGV58ftagMEujUvs0cT+WvbAqW+WsVehCPQDup8w=' 
WHERE 
  key_id = 'fb4e4610d594b1dfb45188958ace1513b4a1d01854dc3df0df521f3cdeb3aac8' 
  AND (
    token = 'ojzZGV58ftagMEujUvs0cT+WvbAqW+WsVehCPQDup8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032