UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'd/YRBH6BEtU7jAHtaNgj3UDnqaqeK2rrT+183Fd+R90='
WHERE
key_id = 'd4cd52f55f210d6ece0c57c43e7231fb997148d8c0a9a6a6a4cdbb057f49a885'
AND (
token = 'd/YRBH6BEtU7jAHtaNgj3UDnqaqeK2rrT+183Fd+R90='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)