UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dwN4ySdyiyZ2p3MnElrLpk12rNYn/0SlYZPOma3yaM0='
WHERE
key_id = 'a7b3707f9f94722dc4b75c703c238daeb40215766e4bd7e90c4578ffd1c47125'
AND (
token = 'dwN4ySdyiyZ2p3MnElrLpk12rNYn/0SlYZPOma3yaM0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)