UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KuTJkYY5MGXS2qwYB38Dp0wTCCy/82ZJxf8mATEFli4='
WHERE
key_id = '6677923671b72f0c266cda5538eb32551ad090cdafe16fccb78baa343621584a'
AND (
token = 'KuTJkYY5MGXS2qwYB38Dp0wTCCy/82ZJxf8mATEFli4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)