UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qZFLps2SGsBAB6pE7zQEyuteev77boVSnW8FIlDgFT4='
WHERE
key_id = '2a7c12b13ee0705a9136b602c6e6873c1f8884a222db4b95f894584b2e4ea93e'
AND (
token = 'qZFLps2SGsBAB6pE7zQEyuteev77boVSnW8FIlDgFT4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)