UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7sbi9V6uR4WEcu6KX9NKXy5MYiFFOzAsbgSSn1xoVk8='
WHERE
key_id = 'e3b7b7ab4b27cbf6f865c44c393764ec79da890c55b3ed02b9140d8212f19ff9'
AND (
token = '7sbi9V6uR4WEcu6KX9NKXy5MYiFFOzAsbgSSn1xoVk8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)