UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'NVgEgqEWvG1cCJfvDh5uRJc6YOwJMuGnMZQut7kmCpc='
WHERE
key_id = 'c05640ce4f125a84a2c14d7b9a04071ef0a6a3e599aa1f241f89ff968bfd1333'
AND (
token = 'NVgEgqEWvG1cCJfvDh5uRJc6YOwJMuGnMZQut7kmCpc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)