UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EFyzy4wVMeeLZK8gUs78EFkFIZisHU9LqbO1osQfmoU='
WHERE
key_id = 'd84f9c5c67114a7525448f948117d466295bf64d168e061b8b1c330b36b9206f'
AND (
token = 'EFyzy4wVMeeLZK8gUs78EFkFIZisHU9LqbO1osQfmoU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)