UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G9pp54mesmHiCJjmRod02cnGIqB30Ls5vqlQ+Ui4HEo='
WHERE
key_id = 'fcdcc54136e4f1a44068c75586c66ca7b8a6a81490b4fbca1e6727b7feac4f98'
AND (
token = 'G9pp54mesmHiCJjmRod02cnGIqB30Ls5vqlQ+Ui4HEo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)