UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Ma3LAEaSvsg+T9o0C+7rUvss3m0FEZdX/61Xt9RHA14='
WHERE
key_id = 'c5d434a4f0630c6f7d82a56f516491ae64bf6f92d7a2c6efec3e652c966bebed'
AND (
token = 'Ma3LAEaSvsg+T9o0C+7rUvss3m0FEZdX/61Xt9RHA14='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)