UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'nDXEdL56+wYgPDRkNesxu+YxZVK2xLix9q4E1SVqjfs='
WHERE
key_id = 'bf98d6290495d689c34b198aa26ce949c24c46dc6d9f7a8b36341bb917abee09'
AND (
token = 'nDXEdL56+wYgPDRkNesxu+YxZVK2xLix9q4E1SVqjfs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)