UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'w9DBW2N03ZkyeswtlkAruGkvSHd6YFVZiKxQyfNxiP4='
WHERE
key_id = '80ce5edf22fd35ddcb84913d461e5521a3d1c47e334c4ec75ad7dca8380518d7'
AND (
token = 'w9DBW2N03ZkyeswtlkAruGkvSHd6YFVZiKxQyfNxiP4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)