UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XDP595NYG/EgOWOnUeMq2XoNvZqYD3kFkPr7V/UNgEY='
WHERE
key_id = 'dff3ba471912330bf27903a6d4eb1f10106aea2204c6397aac2fc7fa98c7ef2a'
AND (
token = 'XDP595NYG/EgOWOnUeMq2XoNvZqYD3kFkPr7V/UNgEY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)