UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fnSRCJoGsG4XvxdPGH6rxDMS1pgVUAKN732TflcZsnY=' 
WHERE 
  key_id = '42a033a31b00195edf76dbaf5709f4eb30c6b629714253ca13de1a16dc814f38' 
  AND (
    token = 'fnSRCJoGsG4XvxdPGH6rxDMS1pgVUAKN732TflcZsnY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024