UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nb3xkkwES3fj20AVT/Kx59aACFsxS1/LuqnspdVEmL4=' 
WHERE 
  key_id = '7ec592ea1020077ec15a75eb25400538e7e68f35ff93c29b7977ec645cd5ec36' 
  AND (
    token = 'nb3xkkwES3fj20AVT/Kx59aACFsxS1/LuqnspdVEmL4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049