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