UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WzfZSw8b6LO0pM6X9JPGNswlaFKO7SzmIIN6NnIDMig=' 
WHERE 
  key_id = '0d6105b8d2e3684e689406835c666873d3fca0f0f6149d66d2065701485ebb11' 
  AND (
    token = 'WzfZSw8b6LO0pM6X9JPGNswlaFKO7SzmIIN6NnIDMig=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038