UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aQcgfnFL4OK97oUQ/Zfi42zCISpsz4VM2p0K5UgZHxk='
WHERE
key_id = 'cf0a0f00933483d5f4add28f3ee8f93fdddfa7229421f0717d67c1853a572889'
AND (
token = 'aQcgfnFL4OK97oUQ/Zfi42zCISpsz4VM2p0K5UgZHxk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)