UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'lK1DUY5raYTKAbLm4QuDXTtS8uKPwFXT5jr85vS+uxs='
WHERE
key_id = 'cd689365988785d4c01e1223b06b3b0bc9f44228792fbff17b5536ea2cd2c75e'
AND (
token = 'lK1DUY5raYTKAbLm4QuDXTtS8uKPwFXT5jr85vS+uxs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)