UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'QXm+SrNZv7F7EDy0nE3XTqIWAVOUNPK7u3kWlRMBiRA='
WHERE
key_id = 'ed9c1bb6f7e2532122b7b9aec8d6d9d286fada9700b4e39c096747a9b16df842'
AND (
token = 'QXm+SrNZv7F7EDy0nE3XTqIWAVOUNPK7u3kWlRMBiRA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)