UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CW513SBGaZa5GCmfoInMwARTUCIFUYLA4qgB3gJsltA='
WHERE
key_id = '24f6c1895412958f2fff4f895472a76168ba1ef80c2cdb9e2c0f69ecd96479bd'
AND (
token = 'CW513SBGaZa5GCmfoInMwARTUCIFUYLA4qgB3gJsltA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)