UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'EgXN4EHizFTql3UvU4bZPkXSSUDHco9TV60AazoB+xA=' 
WHERE 
  key_id = 'c2ff37f5e19944e833959a8bb21f922bd14269072480778640cd7700f886b725' 
  AND (
    token = 'EgXN4EHizFTql3UvU4bZPkXSSUDHco9TV60AazoB+xA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020