UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'a94HFYLXA5VXtmym4kbu477xNr7J3ZSpClOh8Bw6MG0='
WHERE
key_id = 'c0c7d18be8097a61e9db36e4f282bcf19a2f5907f7c7c5af2cfa60217e3598fc'
AND (
token = 'a94HFYLXA5VXtmym4kbu477xNr7J3ZSpClOh8Bw6MG0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)