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