UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xlTSIXQTyLra9Yebu8C86xREiyS1Vw6f+YTs0sk2meA='
WHERE
key_id = 'cdd4a4b213bd875622c52da29d259fed5575fe6eb334dc0f65adec7657add58a'
AND (
token = 'xlTSIXQTyLra9Yebu8C86xREiyS1Vw6f+YTs0sk2meA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)