UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'EheRX3tLbODbRhZ4xCLUVzlKadAOA5BA2Kj/smI0eDg='
WHERE
key_id = '3c328249d4b7bf4313b96752926cbc09a0b0940262294939a3edd0dea31f6bf5'
AND (
token = 'EheRX3tLbODbRhZ4xCLUVzlKadAOA5BA2Kj/smI0eDg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)