UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8R7TNbS8AHiDMNjPiC0ipzvKKGBU71GLlns6f4/LPjw='
WHERE
key_id = '659c80f630d8adeaf9aca18dc5fdfaae13598192fd07599bfe6461f6df196822'
AND (
token = '8R7TNbS8AHiDMNjPiC0ipzvKKGBU71GLlns6f4/LPjw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)