UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C+0Bh6kBYNbDc79tRpXdaXTPHfRHgQNhhM4p70DzFko='
WHERE
key_id = '52521be6f0f86f926d99e0eedea7ed85c2a98a9becfa7d20b1cdc633d8bc6f8d'
AND (
token = 'C+0Bh6kBYNbDc79tRpXdaXTPHfRHgQNhhM4p70DzFko='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)