UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Ttz0P4dleSz13y+l3c7qgps11oykl4SvdV5S4XpXvW8=' 
WHERE 
  key_id = 'a073bd8af1ba50ae25b84ca0d94a63d480301e80aa45115617080915d8637a46' 
  AND (
    token = 'Ttz0P4dleSz13y+l3c7qgps11oykl4SvdV5S4XpXvW8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037