UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'TiykJiRaScan+8CpAPgDpReVgppjkCIp7toy1VWoYvM='
WHERE
key_id = 'efaae5867987f6cf195a917d8fcf5a1b28eda26254fa7b3ff590f5e06db8be4e'
AND (
token = 'TiykJiRaScan+8CpAPgDpReVgppjkCIp7toy1VWoYvM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)