UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gCWrTUwZf02LzmY8vgNTlHKVHQVTzlo2GnyKPl5Ao54=' 
WHERE 
  key_id = '3ccceeaa4a007066e008c0d7505753ed1712c8b312460441339fbbbd260b5b0c' 
  AND (
    token = 'gCWrTUwZf02LzmY8vgNTlHKVHQVTzlo2GnyKPl5Ao54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032