UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'KrZOrYe/aqI4lNRbr7GDZz8idKEth9x3wNqSXdoIChM='
WHERE
key_id = '3f091c8da47c7483e8cdfbf543d62d3f98138a5708cc0121adc9cf78f9143285'
AND (
token = 'KrZOrYe/aqI4lNRbr7GDZz8idKEth9x3wNqSXdoIChM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)