UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'APxNjOZlTC1sjumiglYuo/VWZLcP/fJ0H+sP6FoKj00='
WHERE
key_id = 'f59750ef44e38f60c20683da50f299549be339ce97f88a2b29d88f013cff2f06'
AND (
token = 'APxNjOZlTC1sjumiglYuo/VWZLcP/fJ0H+sP6FoKj00='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)