UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sKEXifLm1u9NBel4bfLdOHPlx7t7M+QydyH8S5YjU6w='
WHERE
key_id = '4b5d9b0033e5e398ef896462c74bba8ac89cd4b369f28d4b0b48e8dc2e80e398'
AND (
token = 'sKEXifLm1u9NBel4bfLdOHPlx7t7M+QydyH8S5YjU6w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)