UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'yCblxbA582tp23vNyisAd041nTVmbfMInU8GM+tapW4='
WHERE
key_id = '34bcdf81bed4db410e0bb32c8d07c931f698e3afa8b461a888e8146c6e9e21d6'
AND (
token = 'yCblxbA582tp23vNyisAd041nTVmbfMInU8GM+tapW4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)