UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Apij4jL9nSdLU+x6CtYemAOVzv4sFLPL9ArK2symkRs=' 
WHERE 
  key_id = '45305882e63bd208f36426a4096f6d6f2dc829084efb9572a64928216c8b3b87' 
  AND (
    token = 'Apij4jL9nSdLU+x6CtYemAOVzv4sFLPL9ArK2symkRs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031