UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WPiUuAryLXCEt7kt/EWKpguwFsMy3CZavYR/fq2lnY4='
WHERE
key_id = '52dcbd8e05b206851ab4b808dfcb3b99083c0187c18c18541b63d878b792c7d1'
AND (
token = 'WPiUuAryLXCEt7kt/EWKpguwFsMy3CZavYR/fq2lnY4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)