UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'DSKbJCsfJKaddDotmEb54ZCBkxU0N1iAEgpCY4fYU0U='
WHERE
key_id = '0667807d8efb5193f35ac4e5ad430ef580d584c1ad9a51b3e213fbe7af793b51'
AND (
token = 'DSKbJCsfJKaddDotmEb54ZCBkxU0N1iAEgpCY4fYU0U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)