UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '2A0w0hFwZD81XLVG8Z51Pnpj+dFJOAsdn90/u0KfrhU='
WHERE
key_id = '06801b48ac0c1d50beac77f42a13a9ad83318edc070d9bba3901812e6d5d036d'
AND (
token = '2A0w0hFwZD81XLVG8Z51Pnpj+dFJOAsdn90/u0KfrhU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)