UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Yd/zLNRE5hmyZOufSTLiXndeUSd0C+yitAzS3s64+pw='
WHERE
key_id = '042186f7dbecfde24ba950d819555a81a883ccc9d246bb8c1f5e87e184dc01b8'
AND (
token = 'Yd/zLNRE5hmyZOufSTLiXndeUSd0C+yitAzS3s64+pw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)