UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/t48ClxzAKcO0VJ3Ces+shgEeQH2+FsLBQ+pkn9yTWc='
WHERE
key_id = 'c0845eaef31831487b00ca44d91c1137a4c4efd365e14f7f4b53d936da495304'
AND (
token = '/t48ClxzAKcO0VJ3Ces+shgEeQH2+FsLBQ+pkn9yTWc='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)