UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EjjBWGwfRLgtH9M8Zla1nmhuJI8En1yUidZZ1sGazrQ=' 
WHERE 
  key_id = '45e56df16868d8852d542a048c5bd5848e505be130b309c5e4ac47a2234e6c13' 
  AND (
    token = 'EjjBWGwfRLgtH9M8Zla1nmhuJI8En1yUidZZ1sGazrQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015