UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ptzjYvptv1cLpsHN6t5zsUGgI1UHjNiX3EuJxopbgXQ='
WHERE
key_id = 'eba83166d56850bce40d39edf821cbdcab1ffe374f4247388d2a4b7e8d1326b1'
AND (
token = 'ptzjYvptv1cLpsHN6t5zsUGgI1UHjNiX3EuJxopbgXQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)