UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XtO5OdHjp7ytjwkd7/xlAcd9H8FYAwdp/ewiI9MDfUU='
WHERE
key_id = 'd88e3dcc4923758036f115f4c1bcc3b7ac5634d7e74b340747c9694ee925a574'
AND (
token = 'XtO5OdHjp7ytjwkd7/xlAcd9H8FYAwdp/ewiI9MDfUU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)