UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XNUDqMSLnx5YSUysdPGBJdSu0QU7wsfcC14X10Y+1fo='
WHERE
key_id = '0db35d088b2a7b836b8ccf584eaf5934b77325f7686bb732eefd2f8c1f8d648c'
AND (
token = 'XNUDqMSLnx5YSUysdPGBJdSu0QU7wsfcC14X10Y+1fo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)